import Base from '@/common/js/common.js'
import request from '@/common/js/common/request.js'

// 支付下单
export function payOrder(query) {
	return request({
			url: '/pay/payment',
			method: 'post',
			data: query
	})
}

//唤起支付
export function payMent(res){
	let payParam = res.data;
	uni.requestPayment({
		'timeStamp': payParam.timeStamp,
		'nonceStr': payParam.nonceStr,
		'package': payParam.package,
		'signType': payParam.signType,
		'paySign': payParam.paySign,
		'success': function(res) {
			console.log("success");
		},
		'fail': function(res) {
			uni.showToast({
				title: '支付失败',
				mask: true,
				icon: "error",
				duration: 2000
			});
		},
		'complete': function(res) {
			console.log("complete");
		},
	});
}

// 查询支付结果
export function payResult(query) {
	return request({
		url: '/pay/payresult',
		method: 'post',
		data: query
	})
}